%% @author Filippo Pacini <pacini@sgconsulting.it>
%% @copyright 2008 S.G. Consulting s.r.l.
%%
%% @doc ewgi module example. Uses sgte to render a web page.

-module(ewgi_sgte).

-export([render/2]).

-include_lib("ewgi/include/ewgi.hrl").

%% ewgi callback. This is the part that is called.
render(Env, StartResp) ->
    % get template to render and data from ewgi.data environment 
    Tmpl = ewgi_api:get_data("sgte.tmpl", Env),
    Data = ewgi_api:get_data("sgte.data", Env),
    {ok, C} = sgte:compile(Tmpl),
    StartResp(?OK, []),
    sgte:render(C, Data).
    
